<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div id="app">
        <button type="button" v-on:click="onshow">隐藏</button>
        <table border="1" cellpadding="0" cellspacing="0" v-if="show">
            <tr>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
            </tr>
            <tr v-for="user in users">
                <td>{{user.username}}</td>
                <td>{{user.age}}</td>
                <td>{{user.sex}}</td>
            </tr>
        </table>
    </div>
    
    <script src="https://unpkg.com/vue@next"></script>
    <script>
        const app = {
            data() {
                return {
                    users: [{
                        username:"zhangsan",
                        age:18,
                        sex:"男"
                    },{
                        username:"lisi",
                        age:19,
                        sex:"男"
                    },{
                        username:"wangwu",
                        age:20,
                        sex:"女"
                    }],
                    show:true
                }
            },
            methods: {
                onshow() {
                    this.show = !this.show
                }
            }
        }
        Vue.createApp(app).mount("#app");
    </script>
</body>
</html>